import mx.events.EventDispatcher;

import org.molamil.acto.commands.Command;
import org.molamil.acto.commands.CommandContext;
import org.molamil.acto.commands.CommandRequest;
import org.molamil.acto.commands.CommandResult;
import org.molamil.acto.core.Logger;

/**
 * @author Jorge Hernandez
 */
class org.molamil.acto.commands.cmd.AbstractCmd implements Command {
	
		// Properties
	
	private static var log:Logger = Logger.getLogger("AbstractCmd");
	
	private var _context:CommandContext;	private var _request:CommandRequest;	private var _result:CommandResult;
	
	
	// Constructor
	
	private function AbstractCmd(context:CommandContext) {
		_context = context;
		EventDispatcher.initialize(this);
	}
	
	
	// Functions
	
	public function dispatchEvent(eventObj:Object):Void {}
	public function addEventListener(event:String, handler):Void {}
	public function removeEventListener(event:String, handler):Void {}
	
	public function execute(request:CommandRequest):CommandResult {
		log.warning("[Abstract] execute() to be implemented.");
		return null;
	}
	
	public function toString():String {
		var s:String = "org.molamil.acto.commands.cmd.AbstractCmd" +
					   "\n\tcontext = " + context + 
					   "\n\trequest = " + request +					   "\n\tresult = " + result;
		return s;
	}
	
	
	// Getter/Setter
	
	public function get context():CommandContext {
		return _context;
	}
	
	public function get request():CommandRequest {
		return _request;
	}
	
	public function get result():CommandResult {
		return _result;
	}
	
	
}
